﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClasses;

namespace mobliebo
{
    public class Retailer
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _Retailer_id = -99;
        private string _Retailer_name = "";
        private string _Address = "";
        private long _Phno = -99;
        private string _Type_of_mobile = "";
        private bool _isdeleted = false;
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long Retailer_id
        {
            get
            {
                return _Retailer_id;
            }
            set
            {
                _Retailer_id = value;
            }
        }
        public string Retailer_name
        {
            get
            {
                return _Retailer_name;
            }
            set
            {
                _Retailer_name = value;
            }
        }
        public string Address
        {
            get
            {
                return _Address;
            }
            set
            {
                _Address = value;
            }
        }
        public long Phno
        {
            get
            {
                return _Phno;
            }
            set
            {
                _Phno = value;
            }
        }
        public string Type_of_mobile
        {
            get
            {
                return _Type_of_mobile;
            }
            set
            {
                _Type_of_mobile = value;
            }
        }

        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@Retailer_id", Retailer_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@Retailer_name", Retailer_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@Address", Address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@Phno", Phno, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@Type_of_mobile", Type_of_mobile, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@is_deleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                return DAC.Save("Retailer_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long Retailer_id, string Retailer_name, string Address, long Phno, string Type_of_mobile, string andor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@Retailer_id", Retailer_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@Retailer_name", Retailer_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@Address", Address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@Phno", Phno, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@Type_of_mobile", Type_of_mobile, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@is_deleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@andor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6 };
                //return  DAC.Select("Retailer_get",dbparamcall);
                DataTable dt1 = DAC.Select("Retailer_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}


